package main

import (
	"fmt"
	"wanner_service/api"

	"github.com/gin-contrib/cors"
	"github.com/gin-gonic/gin"
)

func main() {
	fmt.Println("===============================")

	app := gin.Default()
	app.Use(cors.New(cors.Config{
		AllowOrigins: []string{"http://wails.localhost:34115"},
		AllowMethods: []string{"PUT", "HEAD", "GET", "POST", "OPTIONS"},
		AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"},
	}))
	app.GET("/users", api.GetUser)

	app.POST("/login", api.DoLogin)
	app.POST("/register", api.AddUser)

	app.Run("127.0.0.1:8000")

}
